package com.nuoniu.sibanyun.controller.project;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.project.SysSdtProjectFile;
import com.nuoniu.sibanyun.service.project.ISysSdtProjectFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 文件管理
 * @auther 小啊刚
 * @date 2021-06-17
 */
@RestController
@RequestMapping("/sdt/file")
@Api(tags = "项目文件管理")
public class SysSdtProjectFileController {

    @Autowired
    private ISysSdtProjectFileService fileService;

    @ApiOperation("保存")
    @PostMapping("save")
    public HttpResult<SysSdtProjectFile> save(@RequestBody SysSdtProjectFile projectFile) {
        fileService.saveProjectFile(projectFile);
        return HttpResult.ok();
    }

    @ApiOperation("获取列表")
    @GetMapping("pageList")
    public HttpResult pageLst(Page page, SysSdtProjectFile file) {
        return HttpResult.ok(fileService.pageList(page, file));
    }

    @ApiOperation("删除")
    @DeleteMapping("delete")
    public HttpResult delete(Long id) {
        fileService.removeById(id);
        return HttpResult.ok();
    }
}
